<template>
  <div class="home">
    <el-container>
      <el-aside :width="collapse?auto:width">
        <div class="aside-head">
          <div class="avatar">
            <img
              src="../assets/66.jpg"
              alt=""
            >
          </div>
           <h4>孔卓婵</h4>
        </div>
        <el-col :span="12">
          <el-menu
            :collapse="collapse"
            default-active="2"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            background-color="#243443"
            text-color="#fff"
            active-text-color="#ffd04b"
            :router="true"
          >
            <el-submenu index="users">
              <template slot="title">
                <i class="fa fa-user"></i>
                <span>用户管理</span>
              </template>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title">
                <i class="fa fa-bars"></i>
                <span>用户管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="2-1">选项1</el-menu-item>
                <el-menu-item index="2-2">选项2</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <el-submenu index="3">
              <template slot="title">
                <i class="fa fa-product-hunt"></i>
                <span>用户管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="3-1">选项1</el-menu-item>
                <el-menu-item index="3-2">选项2</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-col>
      </el-aside>
      <el-container>
        <el-header>
          <span
            class="myicon myicon-menu toggle-btn"
            @click="collapse=!collapse"
          ></span>
          <el-button class="btn-out fa fa-sign-out" type="text" @click='logout'>退出</el-button>
        </el-header>
        <el-main>
            <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>
export default {
  data () {
    return {
      auto: 'auto',
      width: '200px',
      collapse: false
    }
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    logout () {

    }
  }
}
</script>
<style lang="scss" scoped>
.home {
  height: 100%;
  .el-menu-admin:not(.el-menu--collapse) {
    width: 200px;
    // min-height: 400px;
  }
  .el-container {
    height: 100%;
  }
  .el-header {
    background-color: white;
    color: #333;
    span {
      float: left;
      font-size: 36px;
      padding-top: 10px;
      cursor: pointer;
      color: skyblue;
    }
  }
  .el-aside {
    background-color: #243443;
    color: #333;
    // height: 100%;
  }
  .el-main {
    background-color: #e9eef3;
    color: #333;
  }
  .el-col{
      width: 100%;
  }
  .aside-head {
    height: 135px;
    padding-top: 25px;
    text-align: center;
    // background-color: #243443;
    .avatar {
      width: 80px;
      height: 80px;
      margin: 0 auto;
      overflow: hidden;
      border: 3px solid rgba(255, 255, 255, 0.3);
      border-radius: 50%;
      img {
        width: 100%;
        display: block;
      }
    }
     H4{
        color: white;
        font-size: 20px;
        margin-top: 10px;
        z-index: 5;
      }
  }
}
.fa {
  widows: 10px;
  height: 10px;
  font-size: 18px;
  padding-right: 10px;
}
.btn-out{
    float: right;
    line-height: 30px;
}
</style>
